package org.ccay.audit.service.impl;

import java.lang.reflect.Method;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * 抽象的日志AOP拦截器
 * 
 * Created：2011-9-8
 * @author chaowangbang
 * @version:
 */
public abstract class LogAspectSupport implements MethodInterceptor {
	
	/* (non-Javadoc)
	 * @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
	 */
	public Object invoke(final MethodInvocation invocation) throws Throwable {
		Method method = invocation.getMethod();

		return execute(invocation, invocation.getThis(), method, invocation.getArguments());
	}
	
	/**
	 * 拦截处理	
	 * @author chaowangbang
	 * @since Dec 26, 2011
	 * @param invocation
	 * @param target 被调用的目标对象
	 * @param method 当前的调用方法
	 * @param args 方法的参数
	 * @return 执行结果
	 * @throws Throwable
	 */
	protected abstract Object execute(MethodInvocation invocation, Object target, Method method, Object[] args) throws Throwable;

}
